package com.ordersystem.service.impl;

import com.ordersystem.domain.DishCategory;
import com.ordersystem.mappers.CategoryMapepr;
import com.ordersystem.mappers.DishMapper;
import com.ordersystem.service.CategoryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author : asus1020
 * @version : [v1.0]
 * @className : CategoryServiceImpl
 * @description : [描述说明该类的功能]
 * @createTime : [2022/3/26 12:44]
 * @updateUser : asus1020
 * @updateTime : [2022/3/26 12:44]
 * @updateRemark : [描述说明本次修改内容]
 */
@Service
public class CategoryServiceImpl implements CategoryService {
    @Resource
    private CategoryMapepr categoryMapepr;
    @Resource
    private DishMapper dishMapper;
    @Override//查询所有分类
    public List<DishCategory> findCategorys() {
        return categoryMapepr.findCategorys();
    }

    @Override//根据id查询分类
    public DishCategory findCategoryById(Integer cid) {
        return categoryMapepr.findCategoryById(cid);
    }

    @Override//删除分了信息和对应的分类菜品
    public int deleteCategory(Integer cid) {
        return categoryMapepr.deleteCategory(cid);
    }

    @Override//修改菜品分类信息
    public int updateCategory(DishCategory dishCategory) {
        return categoryMapepr.updateCategory(dishCategory);
    }

    @Override//添加菜品分类
    public int addCategory(DishCategory dishCategory) {
        return categoryMapepr.addCategory(dishCategory);
    }

    @Override
    public int statisticsDishNumberByCid(Integer cid) {
        return dishMapper.statisticsDishNumberByCid(cid);
    }
}
